using System;
using System.Collections.Generic;
using System.Text;
using BusinessObjects.BO_Actions.Module;
using Entity.StoreProcedure;
using BusinessObjects;
using System.Data;
namespace BusinessObjects.BO_GetObjects
{
    public static class BO_Module
    {
        public static DataTable SelectAll(int status)
        {
            try
            {
                BOModule_Select_All action = new BOModule_Select_All();
                usp_Module_Select_All entity = new usp_Module_Select_All();
                entity.STATUS = status;
                return action.ExecuteAndReturnDataTable(entity);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
        public static DataTable BeforeInsert()
        {
            try
            {
                BOModule_Before_Insert action = new BOModule_Before_Insert();
                usp_Module_Before_Insert entity = new usp_Module_Before_Insert();
                return action.ExecuteAndReturnDataTable(entity);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
        public static DataTable SelectType()
        {
            try
            {
                BOModule_Select_Type action = new BOModule_Select_Type();
                usp_Module_Select_Type entity = new usp_Module_Select_Type();
                return action.ExecuteAndReturnDataTable(entity);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
        public static DataTable SelectLocationAdmin(int location)
        {
            try
            {
                BOModule_Select_All_Location action = new BOModule_Select_All_Location();
                usp_Module_Select_All_Location entity = new usp_Module_Select_All_Location();
                entity.LOCATION = location;
                return action.ExecuteAndReturnDataTable(entity);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }

        public static DataTable SelectLocation(int location)
        {
            try
            {
                BOModule_Select_Home_Location action = new BOModule_Select_Home_Location();
                usp_Module_Select_Home_Location entity = new usp_Module_Select_Home_Location();
                entity.LOCATION = location;
                return action.ExecuteAndReturnDataTable(entity);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
        public static DataTable SelectLocationHomeAdmin(int location)
        {
            try
            {
                BOModule_Select_Location_Home_Admin action = new BOModule_Select_Location_Home_Admin();
                usp_Module_Location_Home_Admin entity = new usp_Module_Location_Home_Admin();
                entity.LOCATION = location;
                return action.ExecuteAndReturnDataTable(entity);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
        public static DataTable SelectLocation(int location, int category)
        {
            try
            {
                BOModule_Select_Detail_Location action = new BOModule_Select_Detail_Location();
                usp_Module_Select_Detail_Location entity = new usp_Module_Select_Detail_Location();
                entity.LOCATION = location;
                entity.CATEGORY = category;
                return action.ExecuteAndReturnDataTable(entity);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
        public static DataTable SelectLocationAdmin(int location, int category)
        {
            try
            {
                BOModule_Select_Category_Location action = new BOModule_Select_Category_Location();
                usp_Module_Select_Category_Location entity = new usp_Module_Select_Category_Location();
                entity.LOCATION = location;
                entity.CATEGORY = category;
                return action.ExecuteAndReturnDataTable(entity);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
        public static DataTable SelectTop(int rows, int status)
        {
            try
            {
                BOModule_Select_Top action = new BOModule_Select_Top();
                usp_Module_Select_Top entity = new usp_Module_Select_Top();
                entity.NUMBERRECORD = rows;
                entity.STATUS = status;
                return action.ExecuteAndReturnDataTable(entity);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
        public static DataTable SearchLike(string keyword, bool iswap)
        {
            try
            {
                BOModule_Search_Like action = new BOModule_Search_Like();
                usp_Module_Search_Like entity = new usp_Module_Search_Like();
                entity.KEYWORD = keyword;
                return action.ExecuteAndReturnDataTable(entity);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
        public static DataTable Search(int module_id)
        {
            try
            {
                BOModule_Search action = new BOModule_Search();
                usp_Module_Search entity = new usp_Module_Search();
                entity.MODULE_ID = module_id;
                return action.ExecuteAndReturnDataTable(entity);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
        public static DataTable SelectWithPaged(int startIndex, int pageCount, int status, string location)
        {
            try
            {
                BOModule_Select_WithPaged action = new BOModule_Select_WithPaged();
                usp_Module_Select_WithPaged entity = new usp_Module_Select_WithPaged();
                entity.STARTINDEX = startIndex;
                entity.MAXRECORDS = pageCount;
                entity.STATUS = status;
                entity.LOCATION = location;
                return action.ExecuteAndReturnDataTable(entity);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
        public static string Insert(int type_id, string full_name, string category_id, int module_content, string location, string top_background, string background, string bottom_background, string font_family, string font_color, int font_size, string font_weight, string sms_systax, int page_size, string read_more_link, bool is_display_on_detail, bool is_display_on_home_page, string sort_display, DateTime created_date, string created_by, DateTime modify_date, string modify_by, bool status)
        {
            try
            {
                BOModule_Insert action = new BOModule_Insert();
                usp_Module_Insert entity = new usp_Module_Insert();
                entity.TYPE_ID = type_id;
                entity.FULL_NAME = full_name;
                entity.CATEGORY_ID = category_id;
                entity.MODULE_CONTENT = module_content;
                entity.LOCATION = location;
                entity.TOP_BACKGROUND = top_background;
                entity.BACKGROUND = background;
                entity.BOTTOM_BACKGROUND = bottom_background;
                entity.FONT_FAMILY = font_family;
                entity.FONT_COLOR = font_color;
                entity.FONT_SIZE = font_size;
                entity.FONT_WEIGHT = font_weight;
                entity.SMS_SYSTAX = sms_systax;
                entity.PAGE_SIZE = page_size;
                entity.READ_MORE_LINK = read_more_link;
                entity.IS_DISPLAY_ON_DETAIL = is_display_on_detail;
                entity.IS_DISPLAY_ON_HOME_PAGE = is_display_on_home_page;
                entity.SORT_DISPLAY = sort_display;
                entity.CREATED_DATE = created_date;
                entity.CREATED_BY = created_by;
                entity.MODIFY_DATE = modify_date;
                entity.MODIFY_BY = modify_by;
                entity.STATUS = status;
                return action.ExecuteAndReturnStringValue(entity);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
        public static string Update(int module_id, int type_id, string full_name, string category_id, int module_content, string location, string top_background, string background, string bottom_background, string font_family, string font_color, int font_size, string font_weight, string sms_systax, int page_size, string read_more_link, bool is_display_on_detail, bool is_display_on_home_page, string sort_display, DateTime created_date, string created_by, DateTime modify_date, string modify_by, bool status)
        {
            try
            {
                BOModule_Update action = new BOModule_Update();
                usp_Module_Update entity = new usp_Module_Update();
                entity.MODULE_ID = module_id;
                entity.TYPE_ID = type_id;
                entity.FULL_NAME = full_name;
                entity.CATEGORY_ID = category_id;
                entity.MODULE_CONTENT = module_content;
                entity.LOCATION = location;
                entity.TOP_BACKGROUND = top_background;
                entity.BACKGROUND = background;
                entity.BOTTOM_BACKGROUND = bottom_background;
                entity.FONT_FAMILY = font_family;
                entity.FONT_COLOR = font_color;
                entity.FONT_SIZE = font_size;
                entity.FONT_WEIGHT = font_weight;
                entity.SMS_SYSTAX = sms_systax;
                entity.READ_MORE_LINK = read_more_link;
                entity.PAGE_SIZE = page_size;
                entity.IS_DISPLAY_ON_DETAIL = is_display_on_detail;
                entity.IS_DISPLAY_ON_HOME_PAGE = is_display_on_home_page;
                entity.SORT_DISPLAY = sort_display;
                entity.CREATED_DATE = created_date;
                entity.CREATED_BY = created_by;
                entity.MODIFY_DATE = modify_date;
                entity.MODIFY_BY = modify_by;
                entity.STATUS = status;
                return action.ExecuteAndReturnStringValue(entity);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
        public static bool Delete(int module_id)
        {
            try
            {
                BOModule_Delete action = new BOModule_Delete();
                usp_Module_Delete entity = new usp_Module_Delete();
                entity.MODULE_ID = module_id;
                return action.ExecuteAndReturnBooleanValue(entity);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
        public static bool Up(int module_id, string location, int category_id)
        {
            try
            {
                BOModule_Up action = new BOModule_Up();
                usp_Module_Up entity = new usp_Module_Up();
                entity.Module_ID = module_id;
                entity.LOCATION = location;
                entity.CATEGORY = category_id;
                return action.ExecuteAndReturnBooleanValue(entity);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
        public static bool Down(int module_id, string location, int category_id)
        {
            try
            {
                BOModule_Down action = new BOModule_Down();
                usp_Module_Down entity = new usp_Module_Down();
                entity.Module_ID = module_id;
                entity.LOCATION = location;
                entity.CATEGORY = category_id;
                return action.ExecuteAndReturnBooleanValue(entity);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
        public static bool Restore(int module_id)
        {
            try
            {
                BOModule_Restore action = new BOModule_Restore();
                usp_Module_Restore entity = new usp_Module_Restore();
                entity.MODULE_ID = module_id;
                return action.ExecuteAndReturnBooleanValue(entity);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
        public static bool is_home(int module_id)
        {
            try
            {
                BOModule_Home action = new BOModule_Home();
                usp_Module_IsHome entity = new usp_Module_IsHome();
                entity.Module_ID = module_id;
                return action.ExecuteAndReturnBooleanValue(entity);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }

        public static bool is_detail(int module_id)
        {
            try
            {
                BOModule_IsDetail action = new BOModule_IsDetail();
                usp_Module_IsDetail entity = new usp_Module_IsDetail();
                entity.Module_ID = module_id;
                return action.ExecuteAndReturnBooleanValue(entity);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
        public static bool Order(string cid_lid, string l_mid, string m_s, string o_s)
        {
            try
            {
                BOModule_Order action = new BOModule_Order();
                usp_Module_Order entity = new usp_Module_Order();
                entity.CID_LID = cid_lid;
                entity.LIST_MID_ORDER = l_mid;
                entity.MID_ORDER_SEPARATOR = m_s;
                entity.ORDER_SEPARATOR = o_s;
                return action.ExecuteAndReturnBooleanValue(entity);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
        public static DataTable SelectByType(int type_id)
        {
            try
            {
                BOModule_Select_By_Type action = new BOModule_Select_By_Type();
                usp_Module_Select_By_Type entity = new usp_Module_Select_By_Type();
                entity.TYPE_ID = type_id;
                return action.ExecuteAndReturnDataTable(entity);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
    }
}

